package br.com.translog.modelo;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

@Entity
@Table(name = "\"GrupoAcesso\"", catalog = "\"Translog\"", schema = "\"EsqTranslog\"")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "GrupoAcesso.findAll", query = "SELECT g FROM GrupoAcesso g"),
    @NamedQuery(name = "GrupoAcesso.findByCodigo", query = "SELECT g FROM GrupoAcesso g WHERE g.codigo = :codigo"),
    @NamedQuery(name = "GrupoAcesso.findByDescricao", query = "SELECT g FROM GrupoAcesso g WHERE g.descricao = :descricao")})
public class GrupoAcesso implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "\"Codigo\"")
    private Integer codigo;
    @Basic(optional = false)
    @Column(name = "\"Descricao\"")
    private String descricao;
    @OneToMany(mappedBy = "codigoGrupoAcesso")
    private List<Funcionario> funcionarioList;

    public GrupoAcesso() {
    }

    public GrupoAcesso(Integer codigo) {
        this.codigo = codigo;
    }

    public GrupoAcesso(Integer codigo, String descricao) {
        this.codigo = codigo;
        this.descricao = descricao;
    }

    public Integer getCodigo() {
        return codigo;
    }

    public void setCodigo(Integer codigo) {
        this.codigo = codigo;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    @XmlTransient
    public List<Funcionario> getFuncionarioList() {
        return funcionarioList;
    }

    public void setFuncionarioList(List<Funcionario> funcionarioList) {
        this.funcionarioList = funcionarioList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codigo != null ? codigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof GrupoAcesso)) {
            return false;
        }
        GrupoAcesso other = (GrupoAcesso) object;
        if ((this.codigo == null && other.codigo != null) || (this.codigo != null && !this.codigo.equals(other.codigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.translog.modelo.GrupoAcesso[ codigo=" + codigo + " ]";
    }
}
